Skip post-warp-sync wait in parachain bootstrap#3246
Conversation
Benchmark resultsPaseo + Asset Hub Paseo, time-to-finalized, n=10 iterations.
Highlights:
|
bkchr
left a comment
There was a problem hiding this comment.
You have merged these two branches, can you explain on what is the difference to before? Why is this now sending the required events.
| if use_pre_warp_finalized { | ||
| // Pre-complete the runtime so the tree-advance loop emits | ||
| // `Block` + `Finalized` without an actual download. | ||
| let warp_synced_idx = new_tree.input_insert_block( | ||
| warp_synced_block.clone(), | ||
| None, | ||
| false, | ||
| true, | ||
| ); | ||
| let async_op = match new_tree | ||
| .next_necessary_async_op(&background.platform.now()) | ||
| { | ||
| async_tree::NextNecessaryAsyncOp::Ready(op) => op, | ||
| async_tree::NextNecessaryAsyncOp::NotReady { .. } => unreachable!( | ||
| "warp-synced block just inserted with pending async op" | ||
| ), | ||
| }; | ||
| debug_assert_eq!(async_op.block_index, warp_synced_idx); | ||
| new_tree.async_op_finished(async_op.id, runtime); | ||
| new_tree.input_finalize(warp_synced_idx); | ||
| } |
There was a problem hiding this comment.
Can you explain what this changes?
There was a problem hiding this comment.
What I wanted here is to:
- attach the warp-synced runtime to the warp_synced_block
- mark the block as the next finalized
Not sure if this is fine to set same_async_op_as_parent = true, because it would implicate using the finalized_async_user_data we used to build the tree, which I deliberately set as Err(RuntimeError::CodeNotFound), because there is no actual runtime that could be associated with pre_warp_finalized block (there is no guarantee that pre_warp_finalized block uses the same runtime as warp_synced_block).
We could use warp-synced runtime as finalized_async_user_data when building a tree and then we could use approach suggested by you. Though not sure about the case when someone invokes runtime_call against pre_warp_finalized block and its runtime is supposed to be different than for warp_synced_block.
If this is a case, then better to return RuntimeError::CodeNotFound.
|
Don't we just need to set this to |
|
Not sure what branches you mean. Is this about the difference between this PR and #3210 ? |
Problem
After a relay-chain warp sync, the runtime_service places the warp-synced block directly as the outer
finalized_block— it never enters the innerasync_tree, so subscribers never receiveBlock/Finalizednotifications for it.fetch_parachain_head_from_relaywaits for the nextNotification::Finalized, which only fires when the relay finalizes the block after the warp-synced one (~6–12 s).Fix
Reshape the warp-sync
MustSubscribepath so the warp-synced block flows through the normalOutputUpdate::Block→OutputUpdate::Finalizedsequence:pre_warp_finalized) becomes the tree's initial finalized state — a tree-level predecessor only, not the real chain parent.input_finalize'd.pre_warp_finalizedas initial finalized, thenBlock(warp_synced)+Finalized(warp_synced)on the channel back-to-back.pre_warp_finalizedis pruned the moment warp-synced is finalized; its placeholder runtime isErr(CodeNotFound).This PR replaces #3210